//
//  HTCFQuickUIUitil.m
//  HTHappySale
//
//  Created by 创维海通 on 2017/9/14.
//  Copyright © 2017年 zxyywy. All rights reserved.
//

#import "HTCFQuickUIUitil.h"
#import "HTHappyUitils.h"

@implementation HTCFQuickUIUitil

+ ( UIColor * _Nullable )colorFromRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue
{
    return [HTCFQuickUIUitil colorFromRed:red green:green blue:blue withAlpha:1.0];
}

+ (UIColor * _Nullable)colorFromRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue withAlpha:(CGFloat)alpha
{
    return [UIColor colorWithRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:alpha];
}

+ (UIColor *)colorFromHexString:(NSString *)hexString
{
    if (HTCFStringIsNull(hexString)) {
        return nil;
    }
    
    unsigned hexNum;
    if ( ![[NSScanner scannerWithString:hexString] scanHexInt:&hexNum] ) {
        return nil;
    }
    
    return [UIColor colorWithRed:((float)((hexNum & 0xFF0000) >> 16))/255.0 green:((float)((hexNum & 0xFF00) >> 8))/255.0 blue:((float)(hexNum & 0xFF))/255.0 alpha:1.0];
}

+ (UIImage *)imageWithName:(NSString *)imageName
{
    if (HTCFStringIsNull(imageName)) {
        return nil;
    }
    return [UIImage imageNamed:imageName];
}

+ (UIImage *)imageWithFilePath:(NSString *)filePath
{
    if (HTCFStringIsNull(filePath)) {
        return nil;
    }
    return [UIImage imageWithContentsOfFile:filePath];
}

+ (float_t)ScreenWithWidth{
    return [[UIScreen mainScreen] bounds].size.width;
}

+ (float_t)ScreenWithHeight{
    return [[UIScreen mainScreen] bounds].size.height;
}

@end
